<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>zxxhouse: src/com/zxx/view/ViewMore.java源文件</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">zxxhouse
   &#160;<span id="projectnumber">1.0</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- 制作者 Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">src/com/zxx/view/ViewMore.java</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="keyword">package </span>com.zxx.view;
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="keyword">import</span> java.util.ArrayList;
<a name="l00004"></a>00004 <span class="keyword">import</span> java.util.LinkedList;
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="keyword">import</span> android.content.Context;
<a name="l00007"></a>00007 <span class="keyword">import</span> android.content.res.Resources;
<a name="l00008"></a>00008 <span class="keyword">import</span> android.util.AttributeSet;
<a name="l00009"></a>00009 <span class="keyword">import</span> android.util.SparseArray;
<a name="l00010"></a>00010 <span class="keyword">import</span> android.view.LayoutInflater;
<a name="l00011"></a>00011 <span class="keyword">import</span> android.view.View;
<a name="l00012"></a>00012 <span class="keyword">import</span> android.widget.LinearLayout;
<a name="l00013"></a>00013 <span class="keyword">import</span> android.widget.ListView;
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="keyword">import</span> com.soufang.ui.R;
<a name="l00016"></a>00016 <span class="keyword">import</span> com.zxx.adapter.*;
<a name="l00017"></a>00017 <span class="keyword">import</span> com.zxx.common.Common;
<a name="l00018"></a>00018 
<a name="l00022"></a><a class="code" href="classcom_1_1zxx_1_1view_1_1_view_more.html">00022</a> <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="classcom_1_1zxx_1_1view_1_1_view_more.html" title="spinner控件更多视图">ViewMore</a> <span class="keyword">extends</span> LinearLayout implements ViewBaseAction {
<a name="l00023"></a>00023         
<a name="l00024"></a>00024         <span class="keyword">private</span> ListView regionListView;
<a name="l00025"></a>00025         <span class="keyword">private</span> ListView plateListView;
<a name="l00026"></a>00026         <span class="keyword">private</span> ArrayList&lt;String&gt; groups = <span class="keyword">new</span> ArrayList&lt;String&gt;();
<a name="l00027"></a>00027         <span class="keyword">private</span> LinkedList&lt;String&gt; childrenItem = <span class="keyword">new</span> LinkedList&lt;String&gt;();
<a name="l00028"></a>00028         <span class="keyword">private</span> SparseArray&lt;LinkedList&lt;String&gt;&gt; children = <span class="keyword">new</span> SparseArray&lt;LinkedList&lt;String&gt;&gt;();
<a name="l00029"></a>00029         <span class="keyword">private</span> <a class="code" href="classcom_1_1zxx_1_1adapter_1_1_text_adapter.html" title="expandTabView的通用适配器">TextAdapter</a> plateListViewAdapter;
<a name="l00030"></a>00030         <span class="keyword">private</span> <a class="code" href="classcom_1_1zxx_1_1adapter_1_1_text_adapter.html" title="expandTabView的通用适配器">TextAdapter</a> earaListViewAdapter;
<a name="l00031"></a>00031         <span class="keyword">private</span> OnSelectListener mOnSelectListener;
<a name="l00032"></a>00032         <span class="keyword">private</span> <span class="keywordtype">int</span> leftPosition = 0;
<a name="l00033"></a>00033         <span class="keyword">private</span> <span class="keywordtype">int</span> rightPosition = 0; 
<a name="l00034"></a>00034         <span class="keyword">private</span> String showString;
<a name="l00035"></a>00035         <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keywordtype">int</span> RightSortKey =0;
<a name="l00036"></a>00036         <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keywordtype">int</span> RightRoomKey =1;
<a name="l00037"></a>00037         <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keywordtype">int</span> RightZXKey =2;
<a name="l00038"></a>00038         <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keywordtype">int</span> RightPriceKey =3;
<a name="l00039"></a>00039         
<a name="l00040"></a>00040          <span class="keyword">private</span> <span class="keywordtype">int</span>[] viewLeftRow = <span class="keyword">new</span> <span class="keywordtype">int</span>[] {
<a name="l00041"></a>00041                           R.string.sort,
<a name="l00042"></a>00042                           R.string.buildType,R.string.zx,R.string.perprice
<a name="l00043"></a>00043           };
<a name="l00044"></a>00044         
<a name="l00045"></a>00045          <span class="keyword">private</span> <span class="keywordtype">int</span>[] viewRightSort = <span class="keyword">new</span> <span class="keywordtype">int</span>[] {
<a name="l00046"></a>00046                           R.string.origion,
<a name="l00047"></a>00047                           R.string.sortByPriceH_L,R.string.sortByPriceL_H,R.string.sortByYearH_L,
<a name="l00048"></a>00048                           R.string.sortByYearL_H,R.string.sortByAreaH_L,R.string.sortByAreaL_H
<a name="l00049"></a>00049           };
<a name="l00050"></a>00050          
<a name="l00051"></a>00051          <span class="keyword">private</span> <span class="keywordtype">int</span>[] viewRightRoom = <span class="keyword">new</span> <span class="keywordtype">int</span>[] {
<a name="l00052"></a>00052                           R.string.oneRoom,
<a name="l00053"></a>00053                           R.string.twoRoom,R.string.threeRoom
<a name="l00054"></a>00054           };
<a name="l00055"></a>00055         
<a name="l00056"></a>00056         
<a name="l00057"></a>00057         
<a name="l00058"></a>00058          <span class="keyword">private</span> <span class="keywordtype">int</span>[] viewRightPrice = <span class="keyword">new</span> <span class="keywordtype">int</span>[] {
<a name="l00059"></a>00059                           R.string.below1w,
<a name="l00060"></a>00060                           R.string.between1w_2w,R.string.above2w
<a name="l00061"></a>00061           };
<a name="l00062"></a>00062         
<a name="l00063"></a>00063         <span class="keyword">public</span> <a class="code" href="classcom_1_1zxx_1_1view_1_1_view_more.html" title="spinner控件更多视图">ViewMore</a>(Context context) {
<a name="l00064"></a>00064                 super(context);
<a name="l00065"></a>00065                 init(context);
<a name="l00066"></a>00066         }
<a name="l00067"></a>00067 
<a name="l00068"></a>00068         <span class="keyword">public</span> <a class="code" href="classcom_1_1zxx_1_1view_1_1_view_more.html" title="spinner控件更多视图">ViewMore</a>(Context context, AttributeSet attrs) {
<a name="l00069"></a>00069                 super(context, attrs);
<a name="l00070"></a>00070                 init(context);
<a name="l00071"></a>00071         }
<a name="l00072"></a>00072 
<a name="l00073"></a>00073         <span class="keyword">private</span> <span class="keywordtype">void</span> init(Context context) {
<a name="l00074"></a>00074                 
<a name="l00075"></a>00075                 LayoutInflater inflater = (LayoutInflater) context
<a name="l00076"></a>00076                                 .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
<a name="l00077"></a>00077                 inflater.inflate(R.layout.view_region, <span class="keyword">this</span>, <span class="keyword">true</span>);
<a name="l00078"></a>00078                 regionListView = (ListView) findViewById(R.id.listView);
<a name="l00079"></a>00079                 plateListView = (ListView) findViewById(R.id.listView2);
<a name="l00080"></a>00080                 setBackgroundDrawable(getResources().getDrawable(
<a name="l00081"></a>00081                                 R.drawable.choosearea_bg_left));
<a name="l00082"></a>00082 
<a name="l00083"></a>00083                 <a class="code" href="classcom_1_1zxx_1_1view_1_1_view_more.html#ac4bcc58478d6946a1cbd07aabef81552">initChildData</a>();
<a name="l00084"></a>00084 
<a name="l00085"></a>00085                 earaListViewAdapter = <span class="keyword">new</span> <a class="code" href="classcom_1_1zxx_1_1adapter_1_1_text_adapter.html" title="expandTabView的通用适配器">TextAdapter</a>(context, groups,
<a name="l00086"></a>00086                                 R.drawable.choose_item_selected,
<a name="l00087"></a>00087                                 R.drawable.choose_eara_item_selector);
<a name="l00088"></a>00088                 earaListViewAdapter.setTextSize(17);
<a name="l00089"></a>00089                 earaListViewAdapter.setSelectedPositionNoNotify(leftPosition);
<a name="l00090"></a>00090                 regionListView.setAdapter(earaListViewAdapter);
<a name="l00091"></a>00091                 earaListViewAdapter
<a name="l00092"></a>00092                                 .setOnItemClickListener(<span class="keyword">new</span> <a class="code" href="classcom_1_1zxx_1_1adapter_1_1_text_adapter.html" title="expandTabView的通用适配器">TextAdapter</a>.OnItemClickListener() {
<a name="l00093"></a>00093 
<a name="l00094"></a>00094                                         @Override
<a name="l00095"></a>00095                                         <span class="keyword">public</span> <span class="keywordtype">void</span> onItemClick(View view, <span class="keywordtype">int</span> position) {
<a name="l00096"></a>00096                                                 <span class="keywordflow">if</span> (position &lt; children.size()) {
<a name="l00097"></a>00097                                                         childrenItem.clear();
<a name="l00098"></a>00098                                                         childrenItem.addAll(children.get(position));
<a name="l00099"></a>00099                                                         plateListViewAdapter.notifyDataSetChanged();
<a name="l00100"></a>00100                                                         leftPosition = position;
<a name="l00101"></a>00101                                                 }
<a name="l00102"></a>00102                                         }
<a name="l00103"></a>00103                                 });
<a name="l00104"></a>00104                 <span class="keywordflow">if</span> (leftPosition &lt; children.size())
<a name="l00105"></a>00105                         childrenItem.addAll(children.get(leftPosition));
<a name="l00106"></a>00106                 plateListViewAdapter = <span class="keyword">new</span> <a class="code" href="classcom_1_1zxx_1_1adapter_1_1_text_adapter.html" title="expandTabView的通用适配器">TextAdapter</a>(context, childrenItem,
<a name="l00107"></a>00107                                 R.drawable.choose_item_right,
<a name="l00108"></a>00108                                 R.drawable.choose_plate_item_selector);
<a name="l00109"></a>00109                 plateListViewAdapter.setTextSize(15);
<a name="l00110"></a>00110                 plateListViewAdapter.setSelectedPositionNoNotify(rightPosition);
<a name="l00111"></a>00111                 plateListView.setAdapter(plateListViewAdapter);
<a name="l00112"></a>00112                 plateListViewAdapter
<a name="l00113"></a>00113                                 .setOnItemClickListener(<span class="keyword">new</span> <a class="code" href="classcom_1_1zxx_1_1adapter_1_1_text_adapter.html" title="expandTabView的通用适配器">TextAdapter</a>.OnItemClickListener() {
<a name="l00114"></a>00114 
<a name="l00115"></a>00115                                         @Override
<a name="l00116"></a>00116                                         <span class="keyword">public</span> <span class="keywordtype">void</span> onItemClick(View view, <span class="keyword">final</span> <span class="keywordtype">int</span> position) {
<a name="l00117"></a>00117                                                 
<a name="l00118"></a>00118                                                 showString = childrenItem.get(position);
<a name="l00119"></a>00119                                                 <span class="keywordflow">if</span> (mOnSelectListener != null) {
<a name="l00120"></a>00120                                                         rightPosition = position;
<a name="l00121"></a>00121                                                         mOnSelectListener.getValue(leftPosition,rightPosition,showString);
<a name="l00122"></a>00122                                                 }
<a name="l00123"></a>00123 
<a name="l00124"></a>00124                                         }
<a name="l00125"></a>00125                                 });
<a name="l00126"></a>00126                 
<a name="l00127"></a>00127                 setDefaultSelect();
<a name="l00128"></a>00128         }
<a name="l00129"></a>00129 
<a name="l00130"></a>00130         <span class="keyword">public</span> <span class="keywordtype">void</span> setDefaultSelect() {
<a name="l00131"></a>00131                 regionListView.setSelection(0);
<a name="l00132"></a>00132                 plateListView.setSelection(0);
<a name="l00133"></a>00133         }
<a name="l00134"></a>00134 
<a name="l00135"></a>00135         <span class="keyword">public</span> String getShowText() {
<a name="l00136"></a>00136                 <span class="keywordflow">return</span> showString;
<a name="l00137"></a>00137         }
<a name="l00138"></a>00138 
<a name="l00139"></a>00139         <span class="keyword">public</span> <span class="keywordtype">void</span> setOnSelectListener(OnSelectListener onSelectListener) {
<a name="l00140"></a>00140                 mOnSelectListener = onSelectListener;
<a name="l00141"></a>00141         }
<a name="l00142"></a>00142 
<a name="l00143"></a>00143         <span class="keyword">public</span> <span class="keyword">interface </span>OnSelectListener {
<a name="l00144"></a>00144                 <span class="keyword">public</span> <span class="keywordtype">void</span> getValue(<span class="keywordtype">int</span> leftPosition,<span class="keywordtype">int</span> rightposition,String showText);
<a name="l00145"></a>00145         }
<a name="l00146"></a>00146 
<a name="l00147"></a>00147         @Override
<a name="l00148"></a>00148         <span class="keyword">public</span> <span class="keywordtype">void</span> hide() {
<a name="l00149"></a>00149                 <span class="comment">// TODO Auto-generated method stub</span>
<a name="l00150"></a>00150 
<a name="l00151"></a>00151         }
<a name="l00152"></a>00152 
<a name="l00153"></a>00153         @Override
<a name="l00154"></a>00154         <span class="keyword">public</span> <span class="keywordtype">void</span> show() {
<a name="l00155"></a>00155                 <span class="comment">// TODO Auto-generated method stub</span>
<a name="l00156"></a>00156 
<a name="l00157"></a>00157         }
<a name="l00161"></a><a class="code" href="classcom_1_1zxx_1_1view_1_1_view_more.html#ac4bcc58478d6946a1cbd07aabef81552">00161</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1zxx_1_1view_1_1_view_more.html#ac4bcc58478d6946a1cbd07aabef81552">initChildData</a>()
<a name="l00162"></a>00162         {
<a name="l00163"></a>00163                 Resources r = getResources();
<a name="l00164"></a>00164                 showString = r.getString(R.string.more);
<a name="l00165"></a>00165                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;viewLeftRow.length;i++){
<a name="l00166"></a>00166                         groups.add(i,r.getString(viewLeftRow[i]));
<a name="l00167"></a>00167                         LinkedList&lt;String&gt; tItem = <span class="keyword">new</span> LinkedList&lt;String&gt;();
<a name="l00168"></a>00168                         <span class="keywordflow">switch</span>(i)
<a name="l00169"></a>00169                         {
<a name="l00170"></a>00170                                 <span class="keywordflow">case</span> RightSortKey:
<a name="l00171"></a>00171                                 {
<a name="l00172"></a>00172                                         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j&lt;viewRightSort.length;++j)
<a name="l00173"></a>00173                                         {
<a name="l00174"></a>00174                                                 tItem.add(j,r.getString(viewRightSort[j]));
<a name="l00175"></a>00175                                         }
<a name="l00176"></a>00176                                 }
<a name="l00177"></a>00177                                 <span class="keywordflow">break</span>;
<a name="l00178"></a>00178                                 <span class="keywordflow">case</span> RightRoomKey:
<a name="l00179"></a>00179                                 {
<a name="l00180"></a>00180                                         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j&lt;viewRightRoom.length;++j)
<a name="l00181"></a>00181                                         {
<a name="l00182"></a>00182                                                 tItem.add(j,r.getString(viewRightRoom[j]));
<a name="l00183"></a>00183                                         }
<a name="l00184"></a>00184                                 }
<a name="l00185"></a>00185                                         <span class="keywordflow">break</span>;
<a name="l00186"></a>00186                                 <span class="keywordflow">case</span> RightZXKey:
<a name="l00187"></a>00187                                 {
<a name="l00188"></a>00188                                         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j&lt;<a class="code" href="classcom_1_1zxx_1_1common_1_1_common.html" title="公共通用类，目前包含了消息和字符串">Common</a>.GetLengOFZX();++j)
<a name="l00189"></a>00189                                         {
<a name="l00190"></a>00190                                                 <span class="keywordtype">int</span> resID = <a class="code" href="classcom_1_1zxx_1_1common_1_1_common.html" title="公共通用类，目前包含了消息和字符串">Common</a>.GetZXid(j);
<a name="l00191"></a>00191                                                 tItem.add(j,r.getString(resID));
<a name="l00192"></a>00192                                         }
<a name="l00193"></a>00193                                 }
<a name="l00194"></a>00194                                         <span class="keywordflow">break</span>;
<a name="l00195"></a>00195                                 <span class="keywordflow">case</span> RightPriceKey:
<a name="l00196"></a>00196                                 {
<a name="l00197"></a>00197                                         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j&lt;viewRightPrice.length;++j)
<a name="l00198"></a>00198                                         {
<a name="l00199"></a>00199                                                 tItem.add(j,r.getString(viewRightPrice[j]));
<a name="l00200"></a>00200                                         }
<a name="l00201"></a>00201                                 }
<a name="l00202"></a>00202                                         <span class="keywordflow">break</span>;
<a name="l00203"></a>00203                                 <span class="keywordflow">default</span>:
<a name="l00204"></a>00204                                         <span class="keywordflow">break</span>;
<a name="l00205"></a>00205                         }
<a name="l00206"></a>00206                         children.put(i, tItem);
<a name="l00207"></a>00207                 }
<a name="l00208"></a>00208         }
<a name="l00209"></a>00209 }
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated at 2015年二月4日 星期三 18:11:09 for zxxhouse by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
